using UnityEngine;

namespace PKGames.Utils
{
	public static class ConnectivityUtils
	{
		private enum ConnectionType
		{
			Wifi,
			Cellular,
			Offline,
			Unavailable
		}

		public static string GetConnectivityStatus()
		{
			switch (Application.internetReachability)
			{
			case NetworkReachability.NotReachable:
				return ConnectionType.Offline.ToString().ToLowerInvariant();
			case NetworkReachability.ReachableViaCarrierDataNetwork:
				return ConnectionType.Cellular.ToString().ToLowerInvariant();
			case NetworkReachability.ReachableViaLocalAreaNetwork:
				return ConnectionType.Wifi.ToString().ToLowerInvariant();
			default:
				return ConnectionType.Unavailable.ToString().ToLowerInvariant();
			}
		}
	}
}
